package com.hyts.aop.facade;

import com.hyts.aop.handler.cglib.CglibAopHandler;
import com.hyts.aop.proxy.ProxyBuilder;

/**
 * project-name:coffice-toolbox
 * package-name:com.hyts.aop.facade
 * author:Libo/Alex
 * create-date:2019-07-13 12:28
 * copyright:libo-hyts-github
 * email:libo2dev@aliyun.com
 * description:此类主要用于:
 */
public interface AopCglibExecutor {

    /**
     * <b>executeCglibAopBean</b>
     * <p>执行AOP面向切面变成开发操作</p>
     * @param object 参数传递
     * @return 返回
     * @exception
     */
    @SuppressWarnings("unchecked")
    static <T> T executeCglibAopBean(T object) {
        return (T) new ProxyBuilder(new CglibAopHandler(object),object).build(object.getClass());
    }


    /**
     * <b>executeJdkAopObject</b>
     * <p>执行AOP面向切面变成开发操作</p>
     * @param object
     * @return
     * @exception
     */
    static <T> T executeCglibAopBean(T object,Object... aopWeaveObj) {
        return (T) new ProxyBuilder(new CglibAopHandler(object,aopWeaveObj),object,aopWeaveObj).build(object.getClass());
    }

    /**
     * <b>executeCglibAopObject</b>
     * <p>执行AOP面向切面变成开发操作</p>
     * @param object
     * @return
     * @exception
     */
    static Object executeCglibAopObject(Object object) {
        return new ProxyBuilder(new CglibAopHandler(object)).build();
    }

}
